package control.options;
import control.check.data.ICheckDataListener;
import environment.data.BaseEnvironmentData;
import environment.object.BaseEnvironmentObject;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by vondoom on 04.06.2014.
 */
public class ControlOptions implements IControlOptions<BaseEnvironmentData.EnvironmentData,BaseEnvironmentObject>,ICheckDataListener {

    private static final String CONTROL_NAME = "Control options:";

    private Map<BaseEnvironmentObject,IConfigObject> objectConfig = new ConcurrentHashMap<BaseEnvironmentObject, IConfigObject>();

    @Override
    public void work(){

        for(BaseEnvironmentObject room: objectConfig.keySet()){

        }

    }

    @Override
    public void setRoomAndConfig(BaseEnvironmentObject room,IConfigObject config){
        objectConfig.put(room,config);
    }

    @Override
    public Long getValueByTypeInRoom(BaseEnvironmentObject room, BaseEnvironmentData.EnvironmentData data) {
        return room.getListEnvironmentData().get(0).getValue();
    }

    @Override
    public void setCheckResult(BaseEnvironmentObject room, BaseEnvironmentData.EnvironmentData type, BaseEnvironmentData.EnvironmentOptions options) {
        switch (options){
            case PLUS:{
                ((IManageData)room.getListSensors().get(1)).plusData(room.getListEnvironmentData().get(0),5l);
                break;
            }
            case MINUS:{
                ((IManageData)room.getListSensors().get(2)).minusData(room.getListEnvironmentData().get(0), 5l);
                break;
            }
        }
    }
}
